package practice;
/*
题目：求1+2！+3！+...+20！的和
程序分析：此程序只是把累加变成了累乘
 */
public class practice21 {

    public static void main(String[] args) {
        long sum = 0;
        long num;
        for (int i = 1; i <= 20; i++){
            num = 1;
            for (int j = 1; j <= i; j++){
                num *= j;
            }
            System.out.println(num);
            sum += num;
        }
        System.out.println("sum="+sum);
    }

}
